#!/usr/bin/env escript

main(_) ->
  List = [1, 2, 7, 9, 7, 9, 7, 9, 2, 3, 6],
  {Even, Odd} = get_even_odd(List),
  io:format("~p\n", [Even]),
  io:format("~p\n", [Odd]).

get_even_odd(L) ->
 get_even_odd_acc(L, [], []).

get_even_odd_acc([H|T], Even, Odd) ->
  case (H rem 2) of
    1 -> get_even_odd_acc(T, Even, [H|Odd]);
    0 -> get_even_odd_acc(T, [H|Even], Odd)
  end;
get_even_odd_acc([], Even, Odd) ->
 {Even, Odd}.																		